package com.wsoft.bpm.listener;

import org.activiti.engine.delegate.event.ActivitiCancelledEvent;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.springframework.stereotype.Component;

/**
 * 工作流监听器
 *
 * @Author zhonglj
 * @Date 2024-10-08 17:00
 */
@Component
public class BpmActivitiEventListener implements ActivitiEventListener {
    @Override
    public void onEvent(ActivitiEvent event) {
        if (event instanceof ActivitiCancelledEvent) {
            ActivitiCancelledEvent cancelledEvent = (ActivitiCancelledEvent) event;
            String processInstanceId = cancelledEvent.getProcessInstanceId();
            System.out.println("流程退回了:" + processInstanceId);
        }
    }

    @Override
    public boolean isFailOnException() {
        return false;
    }
}
